package cn.zhj.base.util

import android.content.Context
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import com.jcodecraeer.xrecyclerview.XRecyclerView

object XrvUtils {

    fun setXrv(xrv: XRecyclerView, context: Context) {
        xrv.setLoadingMoreEnabled(true)
        xrv.setPullRefreshEnabled(true)
        xrv.setFootViewText("加载中...", "~~全部内容加载完毕~~")
        xrv.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
    }

    fun setXrvNoRefresh(xrv: XRecyclerView, context: Context) {
        xrv.setLoadingMoreEnabled(false)
        xrv.setPullRefreshEnabled(false)
        xrv.setFootViewText("加载中...", "~~全部内容加载完毕~~")
        xrv.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
    }

    fun setXrvNoRefreshHor(
        xrv: XRecyclerView,
        context: Context
    ) {
        xrv.setLoadingMoreEnabled(false)
        xrv.setPullRefreshEnabled(false)
        xrv.setFootViewText("加载中...", "~~全部内容加载完毕~~")
        xrv.layoutManager = GridLayoutManager(context, 3)
    }

}